/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author taticay
 */
@Entity
@Table(name = "in_line")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InLine.findAll", query = "SELECT i FROM InLine i"),
    @NamedQuery(name = "InLine.findByIdLine", query = "SELECT i FROM InLine i WHERE i.inLinePK.idLine = :idLine"),
    @NamedQuery(name = "InLine.findByIdBrand", query = "SELECT i FROM InLine i WHERE i.inLinePK.idBrand = :idBrand"),
    @NamedQuery(name = "InLine.findByDescription", query = "SELECT i FROM InLine i WHERE i.description = :description"),
    @NamedQuery(name = "InLine.findByCharacters", query = "SELECT i FROM InLine i WHERE i.characters = :characters"),
    @NamedQuery(name = "InLine.findByStatus", query = "SELECT i FROM InLine i WHERE i.status = :status")})
public class InLine implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected InLinePK inLinePK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "characters")
    private String characters;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;
    @JoinColumn(name = "id_brand", referencedColumnName = "id_brand", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private InBrand inBrand;

    public InLine() {
    }

    public InLine(InLinePK inLinePK) {
        this.inLinePK = inLinePK;
    }

    public InLine(InLinePK inLinePK, String description, String characters, boolean status) {
        this.inLinePK = inLinePK;
        this.description = description;
        this.characters = characters;
        this.status = status;
    }

    public InLine(int idLine, int idBrand) {
        this.inLinePK = new InLinePK(idLine, idBrand);
    }

    public InLinePK getInLinePK() {
        return inLinePK;
    }

    public void setInLinePK(InLinePK inLinePK) {
        this.inLinePK = inLinePK;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCharacters() {
        return characters;
    }

    public void setCharacters(String characters) {
        this.characters = characters;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public InBrand getInBrand() {
        return inBrand;
    }

    public void setInBrand(InBrand inBrand) {
        this.inBrand = inBrand;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (inLinePK != null ? inLinePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InLine)) {
            return false;
        }
        InLine other = (InLine) object;
        if ((this.inLinePK == null && other.inLinePK != null) || (this.inLinePK != null && !this.inLinePK.equals(other.inLinePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.InLine[ inLinePK=" + inLinePK + " ]";
    }
    
}
